#include "precompiled.h"
#include "prsTest_CalcExpr.h"
using namespace prsTestCalcExpr;

////////////////////////////////////////////////////////////////////////////////
// Test ////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////

//
void prsTestCalcExpr::Test()
{                                       
/**************
  svl::TWindow MainWin;

  double R = -1*(2+3)/2.0 - ( 5/2.0 == ((1*(2+3)/2.0)) );
  R=R;

  char *S =
  //"1 == 1<1 "

  "-1*(2+3)/2 - \r\n"
  "( 5/2 == ((1*(2+3)/2 )) )"
  ";"

  ;

  svl::TMem Mem; Mem.Add((BYTE*)S,lstrlen(S));
  snt::text::TContext Context; 
  Context.Text() = Mem;

  prs::TNode Result;
  svl::TVariant Parent = &Result;

  TRuleParam RParam(Context,Parent);
  prs::TRuleExpr RExpr (Context,Parent,RParam);
  snt::TRule RRoot;
  
  snt::text::TSequence T(Context);
  snt::TFVoid          F;
  snt::TReturn         Return;

  //         |---------->|
  // RRoot ->|-> RExpr ->|-> ";" --> Return
  RRoot.Name("RRoot")
  | RExpr.New() & T.New(";") & Return.New("RRoot")
  |               T.New(";") & Return.New("RRoot")
  ;
  
  //svl::TMessageModal(RRoot.GetGraphInfo(""));

  if (RRoot.Execute())
  {
    svl::TMessageModal(svl::TString("Normal")
      << "\r\nText:\r\n"   << Context.Text().GetInfo() 
      //<< "\r\nResult:\r\n" << Result.Calc()
      << "\r\nNodes:\r\n"  << Result.GetInfoAsString()
    );
  }
  else 
  { 
    svl::TMessageModal(svl::TString("Errors") 
      << "\r\n" << Context.GetErrorsInfo()
      //<< "\r\nResult:\r\n" << Result.Calc()
      << "\r\nNodes:\r\n"  << Result.GetInfoAsString()
    );
  }
**********************/  
}
